using SKBKontur.Cassandra.Logging.Model;
using SKBKontur.Cassandra.Logging.Storage;
using SKBKontur.Cassandra.Proxy;
using SKBKontur.Cassandra.Proxy.Management;
using SKBKontur.Logging;

namespace SKBKontur.CassandraLogging.Tests.Logging
{
    abstract public class CassandraIntegrationTestBase : TestBase
    {
        protected static SimpleCassandraLoggingConfigurator KeyspaceConfigurator;

        public override void SetUp()
        {
            base.SetUp();
            var Conf = new ConfigurationInfo("Log", "Master", "Exception", "Info", "Warn", "Debug", "Error", "Fatal",
                                             0, 0, 0, 0, 0, 0);
            KeyspaceConfigurator = new SimpleCassandraLoggingConfigurator(Conf,new ConsoleLevelDispatchingLogEventWriterConfigurator("\r\n"),
                                          new ProxyFactory("node1", 9160),
                                          new ProxyFactory("node2", 9160),
                                          new ProxyFactory("node3", 9160));
        }

        public override void TearDown()
        {
            KeyspaceConfigurator.StorageClusterManager.ReportStatistics();
            KeyspaceConfigurator.Dispose();
        }
    }
}